﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeployGames.TweenEngine.equations
{
    public abstract class Cubic : TweenEquation
    {
        public static CubicIN IN = new CubicIN();
        public static CubicOUT OUT = new CubicOUT();
        public static CubicINOUT INOUT = new CubicINOUT();

        #region CubicIN
        public class CubicIN : Cubic
        {
            public override float compute(float t)
            {
                return t * t * t;
            }

            public override string ToString()
            {
                return "Cubic.IN";
            }
        }
        #endregion

        #region CubicOUT
        public class CubicOUT : Cubic
        {

            public override float compute(float t)
            {
                return (t -= 1) * t * t + 1;
            }

            public override string ToString()
            {
                return "Cubic.OUT";
            }
        }
        #endregion

        #region CubicINOUT
        public class CubicINOUT : Cubic
        {

            public override float compute(float t)
            {
                if ((t *= 2) < 1) return 0.5f * t * t * t;
                return 0.5f * ((t -= 2) * t * t + 2);
            }

            public override string ToString()
            {
                return "Cubic.INOUT";
            }
        }
        #endregion
        
    }
}
